<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <script>
    let arr1=[1,4,6,8,12,67,89]
    let arr2=[3,7,11,13,15,22,34]
    // arr2.concat(arr1+arr2)
    // console.log(arr2.concat(arr1))
    // for (let i = 0; i < arr2.length; i++) {
      
    // }
    function ceilNum(length, MaxNum = 10) {
    let arr = []
    for (let i = 0; i < length; i++) {
      let num = Math.ceil(Math.random() * (MaxNum - 1))
      arr.push(num) //这里不能先push再 indexof否则索引会一直大于0
      // 当我在数组里找到了当前的数字 就重新执行
      if (arr.indexOf(num)>-1) {
        // 找到了才会进去
        console.log('arr，找到了才会进去',arr,arr.indexOf(num)>-1);
        this.ceilNum()
      }
      if (arr.length == length) {
        return arr
      }
    }
  }
  // console.log(ceilNum(3,20)); 
  // 递归是相互平行的关系
  function diGui(arr){
    console.log(arr);
    if (!arr) {
      arr=[]
    }
    if (arr.length==6){
      return arr
    }
    arr.push(2)
    diGui(arr)
  }
  diGui()
  </script>
</body>
</html>
